#ifndef QBDDITEM_H
#define QBDDITEM_H

#include <QHash>
#include <QStringList>
#include <QDataStream>
#include <QRegExp>

#include "qnormalize.h"
#include "type_part.h"
#include "line_analyzer_field.h"
#include "regular_expression.h"
#include "db_file_name.h"
#include "search_term.h"
#include "qtrace.h"

class __declspec(dllexport) QBDDItem
{

public:
	QBDDItem(QStringList,QStringList);
	QBDDItem(QByteArray in);
	~QBDDItem();

	QByteArray toBdd();
	QString bddFile() const { return m_bddFile; }
	bool contains(const QString& search);
	quint32 score(QList<QStringList> rules);// rules: 
											//1. Field 
											//2. Search
											//3. Compare
											//4. Score
	QString get(const QString & value) const;
	quint32 sort() const { return m_sort; }
	bool operator <(const QBDDItem& other);
	static QString dbFile() { return QString(DB_DEFAULT_FILE); }
protected:
	QString extractFrom(QString text,QString regexp);
	QHash<QString,QString> m_properties;
	quint32 m_type;
	quint32 m_sort;
	QString m_bddFile;
};

#endif // QBDDITEM_H
